package com.orangelife.webservice.service.property;

import java.io.IOException;
import java.text.ParseException;
import java.util.List;
import java.util.Map;

import javax.jws.WebParam;
import javax.jws.WebService;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response;

import org.apache.cxf.interceptor.InInterceptors;
import org.apache.cxf.interceptor.OutInterceptors;
import org.apache.cxf.jaxrs.ext.multipart.Attachment;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;

import com.orangelife.exception.AppBizException;
import com.orangelife.webservice.service.property.entity.PropComputeBean;
import com.orangelife.webservice.service.property.entity.PropNoticeBean;

@WebService
@InInterceptors(interceptors = "org.apache.cxf.interceptor.LoggingInInterceptor")
@OutInterceptors(interceptors = "org.apache.cxf.interceptor.LoggingOutInterceptor")
public interface PropCollectionWebService {

	/**
	 * 缴费类型：查询
	 * 
	 * @author zxh
	 * @date 2016年3月7日
	 * @param servletRequest
	 * @param commID
	 * @param apartmentID
	 * @return
	 * @throws Exception
	 */
	@GET
	@Path("/FeeDetail")
	@Produces({ "application/json" })
	public Response feeDetail(@Context HttpServletRequest servletRequest,
			@QueryParam("isPre") String isPre,
			@QueryParam("commID") String commID,
			@QueryParam("apartmentID") String apartmentID,
			@QueryParam("FeeTypeID") String FeeTypeID,
			@QueryParam("ts_start") String ts_start,
			@QueryParam("ts_end") String ts_end,
			@QueryParam("orderbytype") String orderbytype) throws Exception;

	/**
	 * 获取缴费类目
	 * 
	 * @author zxh
	 * @date 2016年3月7日
	 * @param servletRequest
	 * @param commID
	 * @param apartmentID
	 * @return
	 * @throws Exception
	 */
	@GET
	@Path("/FeeType")
	@Produces({ "application/json" })
	public Response FeeType(@Context HttpServletRequest servletRequest,
			@QueryParam("commID") String commID,
			@QueryParam("apartmentID") String apartmentID) throws Exception;

	/**
	 * 计算预缴费用
	 * 
	 * @author zxh
	 * @date 2016年3月7日
	 * @param servletRequest
	 * @param commID
	 * @param apartmentID
	 * @return
	 * @throws Exception
	 */
	@POST
	@Path("/FeeDetail/_compute")
	@Produces({ "application/json" })
	public Response feecompute(@Context HttpServletRequest servletRequest,
			@WebParam PropComputeBean propComputeBean) throws Exception;

	/**
	 * 确认收款信息 生成缴费帐单（保存发票单号）
	 * 
	 * @author zxh
	 * @date 2016年3月7日
	 * @param servletRequest
	 * @param commID
	 * @param apartmentID
	 * @return
	 * @throws Exception
	 */
	@POST
	@Path("/PayBill")
	@Produces({ "application/json" })
	public Response PayBill(@Context HttpServletRequest servletRequest,
			@WebParam PropComputeBean propComputeBean) throws Exception;
	/**
	 * 首次公摊表读数录入
	 * @param servletRequest
	 * @param propNoticeBean
	 * @return
	 * @throws Exception
	 */
	@POST
	@Path("/saveOneshareRecord")
	@Produces({ "application/json" })
	public Response saveOneshareRecord(@Context HttpServletRequest servletRequest,
									   @WebParam PropNoticeBean propNoticeBean) throws Exception;


	/**
	 * 确认收款信息 生成缴费帐单（保存发票单号）（新）
	 * 
	 * @author zxh
	 * @date 2016年3月7日
	 * @param servletRequest
	 * @param commID
	 * @param apartmentID
	 * @return
	 * @throws Exception
	 */
	@POST
	@Path("/PayBillNew")
	@Produces({ "application/json" })
	public Response PayBillNew(@Context HttpServletRequest servletRequest,
			@WebParam PropComputeBean propComputeBean) throws Exception;

	/**
	 * 缴费单统计
	 * 
	 * @author zxh
	 * @date 2016年3月7日
	 * @param servletRequest
	 * @param commID
	 * @param apartmentID
	 * @return
	 * @throws Exception
	 */
	@GET
	@Path("/paybilltj")
	@Produces({ "application/json" })
	public Response getpaybilltj(@Context HttpServletRequest servletRequest,
			@QueryParam("commID") String commID,
			@QueryParam("apartmentID") String apartmentID,
			@QueryParam("apartmentNum") String apartmentNum,
			@QueryParam("invoice") String invoice,
			@QueryParam("invoiceNum") String invoiceNum,
			@QueryParam("isInvoice") String isInvoice,
			@QueryParam("invoiceStime") String invoiceStime,
			@QueryParam("invoiceEtime") String invoiceEtime,
			@QueryParam("payStime") String payStime,
			@QueryParam("payEtime") String payEtime,
			@QueryParam("payTypes") String payTypes,
			@QueryParam("ownerName") String ownerName,
			@QueryParam("pageIndex") String pageIndex,
			@QueryParam("pageSize") String pageSize) throws Exception;

	/**
	 * 缴费单查询
	 * 
	 * @author zxh
	 * @date 2016年3月7日
	 * @param servletRequest
	 * @param commID
	 * @param apartmentID
	 * @return
	 * @throws Exception
	 */
	@GET
	@Path("/paybill")
	@Produces({ "application/json" })
	public Response getpaybill(@Context HttpServletRequest servletRequest,
			@QueryParam("commID") String commID,
			@QueryParam("apartmentID") String apartmentID,
			@QueryParam("apartmentNum") String apartmentNum,
			@QueryParam("invoice") String invoice,
			@QueryParam("invoiceNum") String invoiceNum,
			@QueryParam("isInvoice") String isInvoice,
			@QueryParam("invoiceStime") String invoiceStime,
			@QueryParam("invoiceEtime") String invoiceEtime,
			@QueryParam("payStime") String payStime,
			@QueryParam("payEtime") String payEtime,
			@QueryParam("payTypes") String payTypes,
			@QueryParam("ownerName") String ownerName,

			@QueryParam("pageIndex") String pageIndex,
			@QueryParam("pageSize") String pageSize) throws Exception;

	/**
	 * 缴费单明细
	 * 
	 * @author zxh
	 * @date 2016年3月7日
	 * @param servletRequest
	 * @param commID
	 * @param apartmentID
	 * @return
	 * @throws Exception
	 */
	@GET
	@Path("/paybill/{paybillID}/item")
	@Produces({ "application/json" })
	public Response getpaybillitem(@Context HttpServletRequest servletRequest,
			@PathParam("paybillID") String paybillID) throws Exception;

	/**
	 * 修改发票单
	 * 
	 * @author zxh
	 * @date 2016年3月7日
	 * @param servletRequest
	 * @param commID
	 * @param apartmentID
	 * @return
	 * @throws Exception
	 */
	@PUT
	@Path("/paybill")
	@Produces({ "application/json" })
	public Response updatepaybill(@Context HttpServletRequest servletRequest,
			@WebParam PropComputeBean propComputeBean) throws Exception;

	/**
	 * 删除缴费账单
	 * 
	 * @author zxh
	 * @date 2016年3月7日
	 * @param servletRequest
	 * @param commID
	 * @param apartmentID
	 * @return
	 * @throws Exception
	 */
	@DELETE
	@Path("/paybill/{paybillID}")
	@Produces({ "application/json" })
	public Response deletepaybill(@Context HttpServletRequest servletRequest,
			@PathParam("paybillID") String paybillID) throws Exception;

	/**
	 * 生成打印计划
	 * 
	 * @author zxh
	 * @date 2016年3月7日
	 * @param servletRequest
	 * @param commID
	 * @param apartmentID
	 * @return
	 * @throws Exception
	 */
	@POST
	@Path("/proc")
	@Produces({ "application/json" })
	public Response procprintplan(@Context HttpServletRequest servletRequest,
			@WebParam PropNoticeBean propNoticeBean) throws Exception;

	/**
	 * 查询打印计划
	 * 
	 * @author zxh
	 * @date 2016年3月7日
	 * @param servletRequest
	 * @param commID
	 * @param apartmentID
	 * @return
	 * @throws Exception
	 */
	@GET
	@Path("/proc")
	@Produces({ "application/json" })
	public Response getprintplan(@Context HttpServletRequest servletRequest,
			@QueryParam("commID") String commID,
			@QueryParam("planType") String planType,
			@QueryParam("pageIndex") String pageIndex,
			@QueryParam("pageSize") String pageSize) throws Exception;

	/**
	 * 保存小区备注
	 * 
	 * @author zxh
	 * @date 2016年3月7日
	 * @param servletRequest
	 * @param commID
	 * @param apartmentID
	 * @return
	 * @throws Exception
	 */
	@POST
	@Path("/dic")
	@Produces({ "application/json" })
	public Response savedic(@Context HttpServletRequest servletRequest,
			@WebParam PropNoticeBean propNoticeBean) throws Exception;

	/**
	 * 获取小区备注
	 * 
	 * @author zxh
	 * @date 2016年3月7日
	 * @param servletRequest
	 * @param commID
	 * @param apartmentID
	 * @return
	 * @throws Exception
	 */
	@GET
	@Path("/dic")
	@Produces({ "application/json" })
	public Response getdic(@Context HttpServletRequest servletRequest,
			@QueryParam("commID") String commID, @QueryParam("code") String code)
			throws Exception;

	/**
	 * 查询公摊读数
	 * 
	 * @author zxh
	 * @date 2016年3月7日
	 * @param servletRequest
	 * @param commID
	 * @param apartmentID
	 * @return
	 * @throws Exception
	 */
	@GET
	@Path("/shareRecord")
	@Produces({ "application/json" })
	public Response queryshareRecord(
			@Context HttpServletRequest servletRequest,
			@QueryParam("commID") String commID,
			@QueryParam("type") String type,
			@QueryParam("period") String period,
			@QueryParam("search") String search) throws Exception;

	/****
	 * 
	 * @param servletRequest
	 * @param commID
	 * @param type
	 * @param period
	 * @param search
	 * @return
	 * @throws Exception
	 */
	@GET
	@Path("/shareRecords")
	@Produces({ "application/json" })
	public Response queryshareRecords(
			@Context HttpServletRequest servletRequest,
			@QueryParam("commID") String commID,
			@QueryParam("type") String type,
			@QueryParam("period") String period,
			@QueryParam("search") String search) throws Exception;

	/**
	 * 保存读数
	 * 
	 * @author zxh
	 * @date 2016年3月7日
	 * @param servletRequest
	 * @param commID
	 * @param apartmentID
	 * @return
	 * @throws Exception
	 */
	@POST
	@Path("/shareRecord")
	@Produces({ "application/json" })
	public Response saveshareRecord(@Context HttpServletRequest servletRequest,
			@WebParam PropNoticeBean propNoticeBean) throws Exception;

	/**
	 * 查询住户读数
	 * 
	 * @author zxh
	 * @date 2016年3月7日
	 * @param servletRequest
	 * @param commID
	 * @param apartmentID
	 * @return
	 * @throws Exception
	 */
	@GET
	@Path("/apartmentRecord")
	@Produces({ "application/json" })
	public Response queryapartmentRecord(
			@Context HttpServletRequest servletRequest,
			@QueryParam("commID") String commID,
			@QueryParam("type") String type,
			@QueryParam("buildingID") String buildingID,
			@QueryParam("unitID") String unitID,
			@QueryParam("meterTypeID") String meterTypeID,
			@QueryParam("isempty") String isempty,
			@QueryParam("pageIndex") String pageIndex,
			@QueryParam("pageSize") String pageSize) throws Exception;

	@GET
	@Path("/apartmentRecords")
	@Produces({ "application/json" })
	public Response queryapartmentRecords(
			@Context HttpServletRequest servletRequest,
			@QueryParam("period") String period,
			@QueryParam("commID") String commID,
			@QueryParam("type") String type,
			@QueryParam("buildingID") String buildingID,
			@QueryParam("unitID") String unitID,
			@QueryParam("meterTypeID") String meterTypeID,
			@QueryParam("isempty") String isempty,
			@QueryParam("pageIndex") String pageIndex,
			@QueryParam("pageSize") String pageSize) throws Exception;

	@POST
	@Path("/apartmentRecordss")
	@Produces({ "application/json" })
	public Response queryapartmentRecordss(
			@Context HttpServletRequest servletRequest,
			@WebParam Map<String, Object> map) throws Exception;

	/**
	 * 查询住户读数
	 * 
	 * @author zxh
	 * @date 2016年3月7日
	 * @param servletRequest
	 * @param commID
	 * @param apartmentID
	 * @return
	 * @throws Exception
	 */
	@GET
	@Path("/apartmentRecordSum")
	@Produces({ "application/json" })
	public Response queryapartmentRecordsum(
			@Context HttpServletRequest servletRequest,
			@QueryParam("commID") String commID,
			@QueryParam("type") String type,
			@QueryParam("buildingID") String buildingID,
			@QueryParam("unitID") String unitID,
			@QueryParam("meterTypeID") String meterTypeID,
			@QueryParam("isempty") String isempty) throws Exception;

	@GET
	@Path("/apartmentRecordSums")
	@Produces({ "application/json" })
	public Response queryapartmentRecordsums(
			@Context HttpServletRequest servletRequest,
			@QueryParam("period") String period,
			@QueryParam("commID") String commID,
			@QueryParam("type") String type,
			@QueryParam("buildingID") String buildingID,
			@QueryParam("unitID") String unitID,
			@QueryParam("meterTypeID") String meterTypeID,
			@QueryParam("isempty") String isempty) throws Exception;

	/**
	 * 模板下载
	 * 
	 * @author zxh
	 * @date 2016年3月7日
	 * @param servletRequest
	 * @param commID
	 * @param apartmentID
	 * @return
	 * @throws Exception
	 */
	@GET
	@Path("/downmodle")
	@Produces({ "application/json" })
	public Response downmodle(@Context HttpServletRequest servletRequest,
			@Context HttpServletResponse servletResponse,
			@QueryParam("commID") String commID,
			@QueryParam("comm") String comm, @QueryParam("type") String type,
			@QueryParam("unitID") String unitID,
			@QueryParam("buildingID") String buildingID,
			@QueryParam("meterTypeID") String meterTypeID) throws Exception;

	/**
	 * 模板导入
	 * 
	 * @author zxh
	 * @date 2016年3月7日
	 * @param servletRequest
	 * @param commID
	 * @param apartmentID
	 * @return
	 * @throws Exception
	 */
	@POST
	@Path("/uploadmodle")
	@Consumes("multipart/form-data")
	public Response uploadFileList(List<Attachment> attachments,
			@Context HttpServletRequest request) throws AppBizException,
			InvalidFormatException, ParseException, IOException;

	/**
	 * 查询表类型
	 * 
	 * @author zxh
	 * @date 2016年3月7日
	 * @param servletRequest
	 * @param commID
	 * @param apartmentID
	 * @return
	 * @throws Exception
	 */
	@GET
	@Path("/metertype")
	@Produces({ "application/json" })
	public Response querymetertype(@Context HttpServletRequest servletRequest,
			@QueryParam("commID") String commID) throws Exception;

	/**
	 * 功能:确认已经收款
	 * 
	 * @param servletRequest
	 * @param paybillId
	 * 
	 * @return
	 * @throws Exception
	 * */
	@GET
	@Path("/confirmCollection")
	@Produces({ "application/json" })
	public Response confirmCollection(
			@Context HttpServletRequest servletRequest,
			@QueryParam("paybillId") String paybillId) throws Exception;

	/**
	 * 功能:查询缴费账单信息
	 * */

	@GET
	@Path("/getCollectionInfoByUserId")
	@Produces({ "application/json" })
	public Response getCollectionInfoByUserId(
			@Context HttpServletRequest servletRequest,
			@QueryParam("userId") String userId) throws Exception;

}
